<?php
session_start();
include_once("conn.php");
header("Content-Type:text/html;charset=utf-8");
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mycss3.css" />
<script type="javascript" src="jquery-1.7.1.js"></script>
<meta charset="utf-8">
</head>
<body>
<div id="Header">
	<ul id="a">
		<li><a href="index.php">首页</a></li>
		<li><a href="public.php">发现</a></li>
		<?php
		if($_SESSION["current_user"] == NULL )
		{
			echo '<li style="float:right;padding:0 3px;"><a href="reg.php">注册</a></li>';
			echo '<li id="b" style="float:right;padding:0 3px;"><a id="login1" href="#">登录</a></li>';
		}
		else
		{
			echo '<li style="float:right;padding:0 3px;"><a href="login_out.php">注销</a></li>';
			echo '<li style="float:right;padding:0 3px;"><a href="manage.php">'.$_SESSION["current_user"].'</a></li>';
		}
		?>
	</ul>
</div>

<div class="public">
<?php
include_once("conn.php");

$sql = "select category.cate_name,category.cid from category where name='".$_SESSION["current_user"]."'";
$result = mysql_query($sql);
while($gotShow = mysql_fetch_array($result) )
{

	$cid = $gotShow["cid"];
	echo "<div class='pub_cate'>";
	echo '<ul>';
	echo $gotShow["cate_name"];
	$sql = "select distinct link.webname,link.webaddress from cate_link,link,category where cate_link.lid=link.lid && cate_link.cid = '".$cid."' && category.cid=cate_link.cid ";
	$result1 = mysql_query($sql);
	while($gotWebName = mysql_fetch_array($result1) )
	{
		echo '<li>';
		echo "<a href='http://".$gotWebName["webaddress"]."'>".$gotWebName["webname"];
		echo '</a>';
		echo '</li>';
	}
	echo '</ul>';
	echo '</div>';
	
}
?>
</div>
</body>
</html>